import http from '../../http'
import type { ApiResponse } from '@/types/api'

export async function adminCreateCategory(payload: { name: string; description?: string; parentId?: number; sortOrder?: number; status?: number }) {
  const resp = await http.post<ApiResponse<boolean>>('/admin/categories', payload)
  return resp.data
}

export async function adminUpdateCategory(id: number, payload: { name: string; description?: string; parentId?: number; sortOrder?: number; status?: number }) {
  const resp = await http.put<ApiResponse<boolean>>(`/admin/categories/${id}`, payload)
  return resp.data
}

export async function adminDeleteCategory(id: number) {
  const resp = await http.delete<ApiResponse<boolean>>(`/admin/categories/${id}`)
  return resp.data
}


